package study.chapter03.thread.operation;

//中等优先级
public class TestThread6 {
    public static void main(String[] args) {

        //A线程：设置A线程的优先级为最小优先级
        Thread aThread = new Thread(() -> {
            for (int i = 0; i < 4; i++) {
                System.out.println("A线程：" + i);
            }
        }, "A线程");
        aThread.start();
        aThread.setPriority(Thread.MIN_PRIORITY);
        System.out.println("A线程的优先级：" + aThread.getPriority());

        //B线程：设置B线程的优先级为最大优先级
        Thread bThread = new Thread(() -> {
            for (int i = 0; i < 4; i++) {
                System.out.println("B线程：" + i);
            }
        }, "B线程");
        bThread.setPriority(Thread.MAX_PRIORITY);
        bThread.start();
        System.out.println("B线程的优先级：" + bThread.getPriority());

        //主线程
        Thread mainThread = new Thread();
        System.out.println("主线程的优先级：" + mainThread.getPriority());
        for (int i = 0; i < 4; i++) {
            System.out.println("主线程：" + i);
        }
    }
}

